﻿@using System.Threading.Tasks
@using Abp.Application.Services.Dto
@using humocloud.Authorization
@using humocloud.Web.Areas.AppAreaName.Models.Roles
@using humocloud.Web.Areas.AppAreaName.Startup
@using humocloud.Web.Startup
@model RoleListViewModel
@{
    ViewBag.CurrentPageName = AppAreaNamePageNames.Common.Roles;
}
@section Styles
{
    <link rel="stylesheet" abp-href="/view-resources/Areas/AppAreaName/Views/Roles/Index.css" asp-append-version="true" />
}
@section Scripts
{
    <script abp-src="/view-resources/Areas/AppAreaName/Views/_Bundles/role-list.js" asp-append-version="true"></script>
}

<div class="m-subheader ">
    <div class="row align-items-center">
        <div class="mr-auto col-sm-12 col-md-6">
            <h3 class="m-subheader__title m-subheader__title--separator">
                <span>@L("Roles")</span>
            </h3>
            <span class="m-section__sub">
                @L("RolesHeaderInfo")
            </span>
        </div>
        <div class="col-sm-12 col-md-6 text-right">
            @if (IsGranted(AppPermissions.Pages_Administration_Roles_Create))
            {
                <button id="CreateNewRoleButton" class="btn btn-primary blue"><i class="la la-plus"></i> @L("CreateNewRole")</button>
            }
        </div>
    </div>
</div>

<div class="m-content">
    <div class="m-portlet m-portlet--mobile">
        <div class="m-portlet__body">
            <div class="m-form m-form--label-align-right">
                <div class="row m--margin-bottom-10">
                    <div class="col-xl-6">
                        <div class="form-group">
                            @Html.DropDownList(
                                "PermissionSelectionCombobox", Model.Permissions.Select(i => i.ToSelectListItem()),
                                new
                                {
                                    @class = "form-control selectpicker",
                                    data_live_search = "true",
                                    data_none_selected_text = L("FilterByPermission"),
                                    id = "PermissionSelectionCombo"
                                })
                        </div>
                    </div>
                    <div class="col-xl-6 text-right">
                        <button id="RefreshRolesButton" class="btn btn-metal"><i class="la la-refresh"></i> @L("Refresh")</button>
                    </div>
                </div>
            </div>
            <div class="row align-items-center">
                <table id="RolesTable" class="display table table-striped table-bordered table-hover dt-responsive nowrap">
                    <thead>
                        <tr>
                            <th>@L("Actions")</th>
                            <th>@L("RoleName")</th>
                            <th>@L("CreationTime")</th>
                        </tr>
                    </thead>
                </table>
            </div>

        </div>
    </div>
</div>


